package nevo.core;

import java.util.*;

public class ModelThread implements Runnable
{	
	protected Model model;
	
	protected Map<String, Object> input;
	
	protected Map<String, Object> output;
	
	protected boolean started;
	
	protected boolean running;
	
	public boolean isRunning() { return running; }
	public boolean isStarted() { return started; }
	
	
	public ModelThread()
	{
		started = false;
		running = false;		
		output = null;
		input = null;
	}
	
	public void setModelData(Model m, Map<String, Object> in) { model = m; input = in; }
	public Map<String, Object> getModelOutput() { return output; }

	public void run()
	{		
		try {
			started = true;
			running = true;
			output = model.run(input);
		} catch (Exception e) {
			e.printStackTrace(System.err);
		}
		running = false;
	}
}
